package com.xcdh.ittools.controller;

import com.xcdh.commons.annotation.DataSourceSwitch;
import com.xcdh.ittools.service.impl.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {
    @Autowired
    private TestService testService ;




        @RequestMapping("/test")
        @DataSourceSwitch()
        public String test(){
            System.out.print(1/0);
            return "Hello" ;
        }

        @RequestMapping("/testAsync")
        public String testAsync(){
            testService.method1();
            testService.asyncMethod1();
            return "success" ;
        }
    @RequestMapping("/testTx")
    public String testTx(){
        testService.tx1();
        return "success" ;
    }
}
